In the field of communications such as mobile communications and fiber optic communications, a coding technology is used at a transmit end to compress a signal to be transmitted, so as to improve the transmission efficiency, and a corresponding decoding technology is used at a receive end to restore the transmitted signal. According to a characteristic, a transmission condition, and the like of a signal, time domain coding and/or frequency domain coding may be performed on the signal. Different bits for coding are allocated to a time domain signal or a frequency domain signal according to a certain rule, and then the signal is coded according to the allocated bits by using a coding method. To improve the signal transmission efficiency, it is expected that a signal to be transmitted is represented by using as few bits for coding as possible. Therefore, the bits for coding need to be allocated properly, so that output signals are restored with least distortion at the receive end by using decoding.
In an existing coder for an audio signal, when a code rate is low, a coding and decoding effect may generally be good for speech, but the coding and decoding effect is poor for music. To improve the quality of the music when the code rate is low, an input signal is coded by using some bits and by using a time domain coding method; and a frequency domain signal is obtained according to the input signal, and the frequency domain signal is coded by using rest bits and by using a frequency domain coding method. When the frequency domain signal is coded by using the rest bits, a feature of the signal is generally not considered, and bit allocation is uniformly performed on the frequency domain signal, which leads to a poor coding effect for some frequency domain signals. In an existing decoder for an audio signal, the frequency domain signal is restored by simply using the decoding technology corresponding to the coding technology, noise is filled into a frequency domain signal that is not obtained by decoding, and then frequency domain inverse transformation and time domain synthesis processing are performed to obtain the output signal. Extra noise is introduced when the noise is filled into some signals, which reduces the quality of the output signal.
Therefore, an existing solution of performing uniform bit allocation in a frequency domain coding algorithm leads to a poor coding effect for some signals; and the foregoing noise filling processing in an existing frequency domain decoding algorithm reduces the quality of the output signal.